<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>元素内容移动</title>
</head>

<body>
    <div id="bcid1">不要学编程</div>
    <button id="btn">点击移动</button>
    <div id="bcid2"></div>
    <script>
        document.write('将上方内容移动到下方：将上方中的文本赋值给先放的文本，然后删除上方中的文本')
        var bc1 = document.getElementById('bcid1');
        var btn = document.getElementById('btn');
        var bc2 = document.getElementById('bcid2');
        var a = 0;
        btn.onclick = function () {
            if (a == 0) {
                bc2.innerHTML = bc1.innerHTML;
                bc1.innerHTML = '';
                a = 1;
            }else{
                bc1.innerHTML = bc2.innerHTML;
                bc2.innerHTML = '';
                a = 0;
            }
        }
    </script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #bcid1 {
            width: 300px;
            height: 300px;
            background-color: aliceblue;
            margin: 0 auto;
            border: 1px solid black;
            align-content: center;
        }

        #btn {
            width: 100px;
            height: 50px;
            background-color: aquamarine;
            margin: 20px auto;
            border: 0;
            display: block;
        }

        #bcid2 {
            width: 300px;
            height: 300px;
            background-color: aliceblue;
            margin: 0 auto;
            border: 1px solid black;
            align-content: center;
        }
    </style>
</body>

</html>